//得到从前一个页面传递的表单数据
var emId = getQuery("id");

window.onload = function (){
    init();
}

/**
 * 修改数据初始化
 */
function init(){
    axios.get("/em/findById",{
        params:{
            id:emId
        }
    }).then(resp =>{
        var obj = resp.data;

        $("nameSpan").innerHTML = obj.name;
        $("birthdaySpan").innerHTML = obj.birthday;
        $("moneyTxt").value = obj.money;
    })
}

function updateEmployee(){
    axios.get("/em/update",{
        params: {
            id:emId,
            money:$("moneyTxt").value
        }
    }).then(resp =>{
        if(resp.data == "ok"){
            location.href = "/employee/index.html";
        }
    })
}